package com.audaque.springboot.foshanupload.web.nettydemo.handler;

import cn.hutool.json.JSONUtil;
import com.audaque.springboot.foshanupload.web.nettydemo.model.req.MessageReq;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;

/**
 * @ClassName EchoInboundHandler3
 * @Description TODO
 * @Author felix
 * @Date 2019/10/23 13:43
 * @Version 1.0
 **/
public class EchoInboundHandler3 extends ChannelInboundHandlerAdapter {
    //读空闲事件计数
    public static Integer readIdleTimes = 0;
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        System.out.println("进入 EchoInboundHandler3.channelRead");
        EchoInboundHandlerUtils.channelRead(ctx,msg);
        System.out.println("退出 EchoInboundHandler3 channelRead");
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
        System.out.println("[EchoInboundHandler3.channelReadComplete]读取数据完成");
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        System.out.println("[EchoInboundHandler3.exceptionCaught]");
    }

    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
        EchoInboundHandlerUtils.userEventTriggeredClose(ctx, evt);
    }

}
